{% extends 'index.html' %}

{% block body %}
<h2><b> Dettagli generali scontrino</b></h2><br/><br/>
<table>
    <tr>
        <td class="table-header">Data Scontrino</td>
        <td class="table-header">Data Mov.</td>
        <td class="table-header">N° Mov.</td>
</tr>
<tr class="row">
            <td class="odd-detail">{{dao.data_inserimento|string[0:-7]}}</td>
            <td class="odd-detail">{{dao.data_movimento|string[0:-7]}}</td>
            <td class="odd-detail">{{dao.numero_movimento}}</td>
</tr><br/><br/>
</table><br/><br/>
<h3><b> Righe scontrino</b></h3><br/><br/>
<table cellpadding="0" cellspacing="4" border="0">
	<tr>
        <td class="table-header">Articolo</td>
        <td class="table-header">Codice a barre</td>
        <td class="table-header">Descrizione</td>
        <td class="table-header">Quantita'</td>
        <td class="table-header">Prezzo</td>
        <td class="table-header">Sconto</td>
        <td class="table-header">Prezzo Netto</td>
        <td class="table-header">Totale</td>
        </tr>
            {% for riga in dao.righe %}
            <tr class="row">
            <td class="odd-detail">{{riga.codice_articolo}}</td>
            <td class="odd-detail">{{riga.codice_a_barre}}</td>
            <td class="odd-detail">{{riga.descrizione[:20]}}</td>
            <td class="odd-number">{{environment.conf.number_format % (riga.quantita or 0)}}</td>
            <td class="odd-number">{{environment.conf.number_format % (riga.prezzo or 0)}}</td>
            {% if riga.tipo_sconto == 'percentuale' %}
            <td class="odd-number">
                {{environment.conf.number_format % (riga.valore_sconto or 0) + "%"}}
            </td>
            {% else%}
            <td class="odd-number">
                {{environment.conf.number_format % (riga.valore_sconto or 0) + " "}}
            </td>
            {% endif %}
            <td class="odd-number">{{environment.conf.number_format % (riga.prezzo_scontato or 0)}}</td>
            <td class="odd-number"><strong>{{environment.conf.number_format % ( riga.quantita * riga.prezzo_scontato ) or 0}}</strong></td>
        </tr>
            {% endfor %}
        </table>
<br/><br/>
<h3><b> Totali</b></h3><br/><br/>
<table>
    <tr>
        <td class="table-header">Sconti su Totale</td>
        <td class="table-header">Totale assegni</td>
        <td class="table-header">Totale carta di credito</td>
        <td class="table-header">Totale contanti</td>
        <td class="table-header">Totale scontrino</td>
</tr>
<tr class="row">
            {% if dao.sconti %}
                <td class="odd-number">{{utils.mN(dao.sconti[0].valore)}}{{utils.scontiTipo(dao.sconti[0].tipo_sconto)}}</td>
            {% else %}
                <td class="odd-number">0</td>
            {% endif %}
            <td class="odd-number">{{utils.mN(dao.totale_assegni)}}</td>
            <td class="odd-number">{{utils.mN(dao.totale_carta_credito)}}</td>
            <td class="odd-number">{{utils.mN(dao.totale_contanti)}}</td>
            <td class="odd-number"><b>{{utils.mN(dao.totale_scontrino)}}</b></td>
</tr>
</table>
{% endblock %}